﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Remember.WPF.Controls
{
    /// <summary>
    /// Interaction logic for TopMenuControl.xaml
    /// </summary>
    public partial class TopMenuControl : UserControl
    {
        public TopMenuControl()
        {
            InitializeComponent();
        }

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var mi = sender as FrameworkElement;
            if (mi != null && mi.Tag != null)
            {
                var mainWin = MainWindow.CurrentWindow as MainWindow;

                switch (mi.Tag.ToString().ToUpper())
                {
                    case "MAX":

                        if (mainWin != null)
                        {
                            mainWin.Max();

                            mi.Tag = "MAXX";
                        }

                        break;
                    case "MAXX":

                        if (mainWin != null)
                        {
                            mainWin.MaxCancel();
                            mi.Tag = "MAX";
                        }

                        break;

                    case "EXIT":
                        if (mainWin != null)
                        {
                            mainWin.Close();
                        }


                        break;

                    default:
                        break;
                }
            }
        }

        private void menuItemControl1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MenuItem_Click(sender, e);
        }
    }
}
